﻿using System;

namespace Restful.Net.TestHost
{
    public class IOCContainerDummy : IServiceFactory
    {
        public object GetInstance(Type serviceType)
        {
            if (serviceType.IsAssignableFrom(typeof(ContactService)))
            {
                return new ContactService();
            }

            if (serviceType.IsAssignableFrom(typeof(AddressBookService)))
            {
                return new AddressBookService();
            }
            if (serviceType.IsAssignableFrom(typeof(GroupService)))
            {
                return new GroupService();
            }
            
            throw new ArgumentException(string.Format("Unknown type:{0}", serviceType));
        }
    }
}